//
//  FKBalanceDetailCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/28.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKBalanceDetailCell.h"
#import "FKBalance.h"

@interface FKBalanceDetailCell ()

@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *dateLabel;
@property (nonatomic, weak) UILabel *priceLabel;
@property (nonatomic, weak) UILabel *balanceLabel;

@end

@implementation FKBalanceDetailCell

- (void)setupSubviews
{
    [super setupSubviews];
    
    UILabel *titleLabel = [UILabel fk_labelWithFont:fk_adjustFont(15) textColor:fkColor333333];
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    UILabel *dateLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor999999];
    [self.contentView addSubview:dateLabel];
    self.dateLabel = dateLabel;
    
    UILabel *priceLabel = [UILabel fk_labelWithFont:fk_adjustFont(15) textColor:fkColor333333];
    [self.contentView addSubview:priceLabel];
    self.priceLabel = priceLabel;
    
    UILabel *balanceLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor999999];
    [self.contentView addSubview:balanceLabel];
    self.balanceLabel = balanceLabel;
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.top.offset(fk_adjustW(12));
    }];
    [dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel);
        make.bottom.offset(fk_adjustW(-12));
    }];
    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-12);
        make.centerY.equalTo(titleLabel);
    }];
    [balanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(priceLabel);
        make.centerY.equalTo(dateLabel);
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[FKBalance class]]) {
        FKBalance *model = (FKBalance *)data;
        
        self.titleLabel.text = model.status_info;
        self.dateLabel.text = model.addTime;
        self.priceLabel.text = model.price;
        self.balanceLabel.text = model.balance;
    }
}


@end
